import {
  request
} from '../utils/request';

// 投票列表
const voteList = (pageNum, pageSize) => {
  return request({
    url: '/vote/list',
    data: {
      pageNum: pageNum,
      pageSize: pageSize
    }
  });
}

// 投票详情
const voteDetails = (voteId) => {
  return request({
    url: `/vote/${voteId}`
  });
}

// 投票
const voteSubmit = (voteId, optionIds) => {
  return request({
    url: `/vote/voting/${voteId}`,
    method: 'POST',
    data: optionIds
  });
}

module.exports = {
  voteList,
  voteDetails,
  voteSubmit
}